Get N copies of stringΒΆ
Get a string which is N (non-negative integer) copies of a given string.
def larger_string(str, N):
result = ''
for i in range(N):
result = result + str
return result
print(larger_string('abc', 2))
print(larger_string('.py', 3))
Output:
abcabc
.py.py.py